﻿using System;
using System.Collections.Generic;

namespace JiaBao.Core.Data
{
    public class DataSettings
    {
        #region Fields

        #endregion

        #region 属性


        /// <summary>
        /// 数据库
        /// </summary>
        public string Server { get; set; }

        /// <summary>
        /// 数据库
        /// </summary>
        public string DataBase { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string Uid { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Pwd { get; set; }


        public string DataProvider { get; set; }


        /// <summary>
        /// 连接字符串
        /// </summary>
        public string DataConnectionString { get; set; }

        public IDictionary<string, string> RawDataSettings { get; private set; }



        #endregion

        #region Ctor
        public DataSettings()
        {
            RawDataSettings = new Dictionary<string, string>();
        }
        #endregion

        #region 方法

        /// <summary>
        /// 验证DataSettings是否有效
        /// </summary>
        /// <returns></returns>
        public bool IsValid()
        {
            return !String.IsNullOrEmpty(DataProvider) && !String.IsNullOrEmpty(DataConnectionString);
        }
        #endregion
    }
}
